package itbour.onetouchshow.utils.glide;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.bumptech.glide.request.RequestOptions;
import com.youth.banner.loader.ImageLoader;

import itbour.onetouchshow.R;

/**
 * Created by Administrator on 2017/10/14.
 */

public class GlideImageLoader extends ImageLoader {

    @Override
    public void displayImage(Context context, Object path, ImageView imageView) {

        //具体方法内容自己去选择，次方法是为了减少banner过多的依赖第三方包，所以将这个权限开放给使用者去选择
//        imageView.setScaleType(ImageView.ScaleType.FIT_XY);
//        ImageLoader.getInstance().showImage(context,path.toString(),imageView);
//        Glide.with(context).applyDefaultRequestOptions(new RequestOptions().placeholder(R.drawable.place_icon).error(R.drawable.place_icon)).load(path).into(imageView);

        Glide.with(context).setDefaultRequestOptions(new RequestOptions()
                .diskCacheStrategy(DiskCacheStrategy.ALL).centerCrop()
                .error(R.drawable.place_icon)
                .placeholder(R.drawable.place_icon)).load(path).into(imageView);


    }

}
